send_loop_times = 10
wait_timeout = "5"

file_cmd = [
    {
        "cmd": 'AT+FSDEL="fileTest.txt"',
        "match": '.*',
        "wait": b'OK',
        'timeout': wait_timeout
    },
    {
        "cmd": 'AT+FSDEL=?',
        "match": 'AT\+FSDEL=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSCREATE=fileTest.txt',
        "match": 'AT\+FSCREATE=fileTest.txt\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+FSCREATE=?',
        "match": 'AT\+FSCREATE=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSWRITE=?',
        "match": 'AT\+FSWRITE=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSWRITE=fileTest.txt,0,100,10\r\n1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890',
        "match": 'AT\+FSWRITE=fileTest.txt,0,100,10\s{4}>\s{2}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+FSWRITE=fileTest.txt,1,100,10\r\n1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890',
        "match": 'AT\+FSWRITE=fileTest.txt,1,100,10\s{4}>\s{2}OK\s{2}',
        "loop": send_loop_times - 1,
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+FSREAD=?',
        "match": 'AT\+FSREAD=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSREAD=fileTest.txt,0,1000,0',
        "match": 'AT\+FSREAD=fileTest\.txt,0,1000,0\s{4}1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\s{2}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout

    },
    {
        "cmd": 'AT+FSREAD=fileTest.txt,1,999,1',
        "match": 'AT\+FSREAD=fileTest\.txt,1,999,1\s{4}234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\s{2}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+FSFLSIZE=?',
        "match": 'AT\+FSFLSIZE=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSFLSIZE="fileTest.txt"',
        "match": 'AT\+FSFLSIZE="fileTest\.txt"\s{4}\+FSFLSIZE: 1000\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSMEM=?',
        "match": 'AT\+FSMEM=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSMEM',
        "match": 'AT\+FSMEM\s{4}\+FSMEM: \d+ bytes\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSDRIVE=?',
        "match": 'AT\+FSDRIVE=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSDRIVE=0',
        "match": 'AT\+FSDRIVE=0\s{4}\+FSDRIVE: C\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSDRIVE=1',
        "match": 'AT\+FSDRIVE=1\s{4}\+FSDRIVE: D\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSLS="/"',
        "match": 'AT\+FSLS="\/"(?:.|\n)*\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+FSMKDIR=?',
        "match": 'AT\+FSMKDIR=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSMKDIR="MKDIRTEST"',
        "match": 'AT\+FSMKDIR="MKDIRTEST"\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+FSRMDIR=?',
        "match": 'AT\+FSRMDIR=\?\s{4}OK\s{2}'
    },
    {
        "cmd": 'AT+FSRMDIR="MKDIRTEST"',
        "match": 'AT\+FSRMDIR="MKDIRTEST"\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
]
